load(
    "//tools:defaults.bzl",
    "extract_tokens",
    "markdown_to_html",
    "ng_module",
    "ng_test_library",
    "ng_web_test_suite",
    "sass_binary",
    "sass_library",
)

package(default_visibility = ["//visibility:public"])

ng_module(
    name = "datepicker",
    srcs = glob(
        ["**/*.ts"],
        exclude = ["**/*.spec.ts"],
    ),
    assets = [
        ":datepicker-content.css",
        ":datepicker-actions.css",
        ":datepicker-toggle.css",
        ":date-range-input.css",
        ":calendar-body.css",
        ":calendar.css",
    ] + glob(["**/*.html"]),
    deps = [
        "//src:dev_mode_types",
        "//src/cdk/a11y",
        "//src/cdk/bidi",
        "//src/cdk/coercion",
        "//src/cdk/keycodes",
        "//src/cdk/overlay",
        "//src/cdk/platform",
        "//src/cdk/portal",
        "//src/material/button",
        "//src/material/core",
        "//src/material/form-field",
        "//src/material/input",
        "@npm//@angular/animations",
        "@npm//@angular/common",
        "@npm//@angular/core",
        "@npm//@angular/forms",
        "@npm//rxjs",
    ],
)

sass_library(
    name = "datepicker_scss_lib",
    srcs = glob(["**/_*.scss"]),
    deps = [
        "//src/material/button:button_scss_lib",
        "//src/material/core:core_scss_lib",
    ],
)

sass_binary(
    name = "datepicker_content_scss",
    src = "datepicker-content.scss",
    deps = ["//src/material/core:core_scss_lib"],
)

sass_binary(
    name = "datepicker_toggle_scss",
    src = "datepicker-toggle.scss",
    deps = [
        "//src/cdk:sass_lib",
        "//src/material/core:core_scss_lib",
    ],
)

sass_binary(
    name = "calendar_scss",
    src = "calendar.scss",
    deps = [
        "//src/cdk:sass_lib",
        "//src/material/core:core_scss_lib",
    ],
)

sass_binary(
    name = "calendar_body_scss",
    src = "calendar-body.scss",
    deps = [
        "//src/cdk:sass_lib",
        "//src/material/core:core_scss_lib",
    ],
)

sass_binary(
    name = "date_range_input_scss",
    src = "date-range-input.scss",
    deps = [
        "//src/cdk:sass_lib",
        "//src/material/core:core_scss_lib",
    ],
)

sass_binary(
    name = "datepicker_actions_scss",
    src = "datepicker-actions.scss",
)

ng_test_library(
    name = "unit_test_sources",
    srcs = glob(
        ["**/*.spec.ts"],
        exclude = ["**/*.e2e.spec.ts"],
    ),
    deps = [
        ":datepicker",
        "//src/cdk/a11y",
        "//src/cdk/bidi",
        "//src/cdk/keycodes",
        "//src/cdk/overlay",
        "//src/cdk/platform",
        "//src/cdk/scrolling",
        "//src/cdk/testing/private",
        "//src/material/core",
        "//src/material/form-field",
        "//src/material/input",
        "//src/material/testing",
        "@npm//@angular/common",
        "@npm//@angular/forms",
        "@npm//@angular/platform-browser",
        "@npm//rxjs",
    ],
)

ng_web_test_suite(
    name = "unit_tests",
    deps = [":unit_test_sources"],
)

markdown_to_html(
    name = "overview",
    srcs = [":datepicker.md"],
)

extract_tokens(
    name = "tokens",
    srcs = [":datepicker_scss_lib"],
)

filegroup(
    name = "source-files",
    srcs = glob(["**/*.ts"]),
)
